<template>
  <div class="app">
    <TheHeader v-if="!isLoginPage" />
    <main :class="{'full-page': isLoginPage}">
      <router-view v-slot="{ Component }">
        <component :is="Component" />
      </router-view>
    </main>
    <TheFooter v-if="!isLoginPage" />
  </div>
</template>

<script>
import TheHeader from './components/TheHeader.vue'
import TheFooter from './components/TheFooter.vue'

export default {
  name: 'App',
  components: {
    TheHeader,
    TheFooter
  },
  computed: {
    isLoginPage() {
      // 同时处理登录页面和注册页面
      return this.$route && (this.$route.path === '/login' || this.$route.path === '/register');
    }
  }
}
</script>

<style>
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

main.full-page {
  padding: 0;
  margin: 0;
}

img {
  max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
}

/* 修复banner中可能的图片问题 */
.main-image, .qrcode img {
  /* 这里使用base64编码的占位图片 */
  background-color: #eee;
  min-height: 100px;
}
</style>
